<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        class Dog {
            constructor(name , age) {
                this.name = name ;
                this.age = age ;
            }
            say() {
                console.log('hi');
            }
        }


        // extends 继承
        // constructor 函数中必须调用super函数

        class KeJi extends Dog {
            constructor(name , age , color) {
                super(name , age) ;
                this.color = color ;
            }
            speak() {
                console.log('speak');
            }
        }

        const k = new KeJi('cc' , 2 , 'white') ;
        console.log(k);

    </script>
    
</body>
</html>